      <div class="templatemo-content-wrapper">
        <div class="templatemo-content">
          <ul class="nav nav-tabs mytabs">
		  	 <li  class="active"><a href="<?=site_url()?>/nutrition/index">配方列表</a></li>
		  	 <li><a href="<?=site_url()?>/nutrition/add">添加配方</a></li>
		  </ul>
          <div class="row">
            <div class="col-md-12">
              <div class="table-responsive">
                <table class="table table-striped table-hover table-bordered">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>名称</th>
                      <th>操作</th>
                    </tr>
                  </thead>
                  <tbody>
                  	<?php foreach ($nutritions as $item):?>
                    <tr>
                      <td><?php echo $item['id'];?></td>
                      <td><?php echo $item['name'];?></td>
                      <td>
                      	    <a href="<?php echo site_url('nutrition/edit/id/'.$item['id'])?>" class=" ">编辑</a>
                      	    |<a href="#" class="del" data-id="<?php echo $item['id'];?>" >删除</a>
                      </td>
                    </tr>
                     <?php endforeach;?>
                  </tbody>
                </table>
              </div>
              <div class="pagination">
           		 <?php echo $links ;?>
         	 </div>
            </div>
          </div>
        </div>
      </div>
<script>
	$(document).ready(function() {
		$(".del").click(function() {
			if(confirm("确定要删除该配方吗？"))
			{
				var id = $(this).attr("data-id");
				$.ajax({
					url : '<?php echo site_url('nutrition/delete')?>',
					type : "post",
					async : false,
					data : {
						'id' : id
					},
					dataType : "json",
					success : function(data) {
						if(data.code)
						{
							alert(data.msg);
							window.location.reload();
						}else{
							alert(data.msg);
						}
					}
				});
			}
		});
	});
</script>
